home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
014
/
pibcat.arc
/
PIBCAT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-01-20
|
37KB
|
910 lines
(*$V-,G64,P128,R-,K-,C-,U-*)
PROGRAM PibCat;
(*----------------------------------------------------------------------*)
(* *)
(* Program: PIBCAT --- Catalog files on a disk. *)
(* *)
(* Author: Philip R. Burns. *)
(* *)
(* Version: 1.0 January 20, 1987. *)
(* *)
(* Usage: *)
(* PIBCAT v /f=filespec /i=indent /m=margin *)
(* /o=filename /p=pagesize /x *)
(* *)
(* v volume (drive letter) to catalog *)
(* (default is current drive) *)
(* If given as ?, this text is displayed. *)
(* /f=filespec DOS file spec to match when listing *)
(* (default is *.* -- list all files) *)
(* /i=indent # columns to space for .ARC/.LBR entries *)
(* (default is 0) *)
(* /m=margin left margin to leave (default is 0) *)
(* /o=filename write catalog listing to file "filename" *)
(* (default is "CATALOG.LIS") *)
(* /p=pagesize paginate listing using "pagesize" lines *)
(* (default is no pagination) *)
(* /x don't list .ARC/.LBR file contents *)
(* (default is to list .ARC/.LBR contents) *)
(* *)
(* Aborting: Hit ^C to abort catalog listing. *)
(* *)
(* Output: *)
(* *)
(* For each selected file, the file name, size in bytes, and time *)
(* and date of creation are displayed. The same information is *)
(* given for members of .ARC or .LBR files. *)
(* *)
(* Acknowledgments: *)
(* *)
(* The archive search code is based upon TPARCV.PAS written by *)
(* Michael Quinlan and ARCV.ASM written by Vern Buerg. *)
(* *)
(* The library search code is based upon LU.PAS written by *)
(* Steve Freeman. *)
(* *)
(*----------------------------------------------------------------------*)
(* Global declarations *)
(*$I PIBCAT.GLO *)
(* General service subroutines *)
(*$I PIBCATS.PAS *)
(*----------------------------------------------------------------------*)
(* Display_Help --- Display help screen for PibCat *)
(*----------------------------------------------------------------------*)
PROCEDURE Display_Help;
BEGIN (* Display_Help *)
WRITELN;
WRITELN('Program: PIBCAT --- Catalog files on a disk.');
WRITELN('Author: Philip R. Burns.');
WRITELN('Version: 1.0 January 20, 1987.');
WRITELN('Usage: PIBCAT v /f=filespec /i=indent /m=margin /o=filename /p=pagesize /x');
WRITELN(' v volume (drive letter) to catalog');
WRITELN(' (default is current drive)');
WRITELN(' If given as ?, this text is displayed.');
WRITELN(' /f=filespec DOS file spec to match when listing');
WRITELN(' (default is *.* -- list all files)');
WRITELN(' /i=indent # columns to space for .ARC/.LBR entries');
WRITELN(' (default is 0)');
WRITELN(' /m=margin left margin to leave (default is 0)');
WRITELN(' /o=filename write catalog listing to file "filename"');
WRITELN(' (default is "CATALOG.LIS")');
WRITELN(' /p=pagesize paginate listing using "pagesize" lines');
WRITELN(' (default is no pagination)');
WRITELN(' /x don''t list .ARC/.LBR files contents');
WRITELN(' (default is to list .ARC/.LBR contents)');
WRITELN;
WRITELN('Aborting: Hit ^C to abort catalog listing.');
WRITELN;
END (* Display_Help *);
(*----------------------------------------------------------------------*)
(* Initialize --- Initialize PibCat program *)
(*----------------------------------------------------------------------*)
FUNCTION Initialize : BOOLEAN;
VAR
S : AnyStr;
S2 : AnyStr;
I : INTEGER;
J : INTEGER;
Ierr : INTEGER;
(* STRUCTURED *) CONST
Legit_Drives : SET OF CHAR = ['A'..'Z','?'];
BEGIN (* Initialize *)
(* --- Set defaults --- *)
(* Drive to catalog is current drive *)
Cat_Drive := Dir_Get_Default_Drive;
(* Default output file is CATALOG.LIS *)
Output_File_Name := 'CATALOG.LIS';
(* Don't produce paginated listing file *)
Do_Printer_Format := FALSE;
Page_Size := 0;
(* No extra spaces at left margin *)
Left_Margin := 0;
(* No extra indent for .ARC/.LBR *)
ArcLbr_Indent := 0;
(* List contents of .ARC/.LBR files *)
Expand_Arcs := TRUE;
(* No ^C hit yet terminating cataloguing *)
User_Break := FALSE;
(* Catalog all files by default *)
Find_Spec := '*.*';
(* We start on first page *)
Page_Number := 1;
(* Lots of lines left on this page *)
Lines_Left := 32767;
(* No files yet *)
File_Count := 0;
Total_Files := 0;
Total_Space := 0;
Total_Dirs := 0;
(* No titles yet *)
Volume_Title := '';
Subdir_Title := '';
File_Title := '';
(* Not help mode only *)
Help_Only := FALSE;
(* Grab command line parameters *)
FOR I := 1 TO ParamCount DO
BEGIN
S := UpperCase( ParamStr( I ) );
IF ( S[1] = '/' ) THEN
BEGIN
IF ( S[3] = '=' ) THEN
S2 := Substr( S, 4, LENGTH( S ) - 3 )
ELSE
S2 := '';
CASE UpCase( S[2] ) OF
'F': BEGIN
IF ( S2 <> '' ) THEN
Find_Spec := S2;
END;
'I': BEGIN
VAL( S2, J, Ierr );
IF ( Ierr = 0 ) THEN
ArcLbr_Indent := J;
END;
'M': BEGIN
VAL( S2, J, Ierr );
IF ( Ierr = 0 ) THEN
Left_Margin := J;
END;
'O': Output_File_Name := S2;
'P': BEGIN
VAL( S2, J, Ierr );
IF ( Ierr = 0 ) THEN
BEGIN
Page_Size := J;
Lines_Left := J;
END;
Do_Printer_Format := ( Page_Size > 0 );
END;
'X': Expand_Arcs := FALSE;
ELSE;
END (* CASE *);
END
ELSE
IF Cat_Drive IN Legit_Drives THEN
Cat_Drive := S[1];
END;
(* If the drive was a "?" then we have *)
(* a help request. Display help info *)
(* and quit. *)
IF ( Cat_Drive = '?' ) THEN
BEGIN
Display_Help;
Initialize := FALSE;
Help_Only := TRUE;
EXIT;
END;
(* Get string of blanks for left margin *)
Left_Margin_String := DUPL( ' ' , Left_Margin );
(* Open output file *)
(*$I-*)
ASSIGN( Output_File , Output_File_Name );
REWRITE( Output_File );
(*$I+*)
(* Continue if we got it *)
IF ( IOResult = 0 ) THEN
Initialize := TRUE
ELSE
BEGIN
WRITELN;
WRITELN( 'Can''t open output file ', Output_File_Name );
WRITELN;
Initialize := FALSE;
END;
END (* Initialize *);
(*----------------------------------------------------------------------*)
(* Display_Volume_Label --- Display volume label of disk *)
(*----------------------------------------------------------------------*)
PROCEDURE Display_Volume_Label;
VAR
Volume_Label : AnyStr;
Vol_Time : INTEGER;
Vol_Date : INTEGER;
STime : STRING[10];
SDate : STRING[10];
BEGIN (* Display_Volume_Label *)
(* Blank out volume title line *)
Volume_Title := DUPL( ' ' , 80 );
(* Get volume label from DOS *)
Dir_Get_Volume_Label( Cat_Drive, Volume_Label, Vol_Date, Vol_Time );
WRITELN( Output_File );
(* If no volume label, don't output it. *)
IF ( Volume_Label = '' ) THEN
BEGIN
Volume_Title := Left_Margin_String +
' Contents of volume on drive ' +
Cat_Drive +
' as of ' +
DateString +
' at ' +
TimeOfDayString;
IF Do_Printer_Format THEN
BEGIN
WRITELN( Output_File , FF_Char );
WRITE ( Output_File , Volume_Title );
WRITELN( Output_File , ' Page ', Page_Number );
END
ELSE
WRITELN( Output_File , Volume_Title );
Lines_Left := Lines_Left - 1;
END
ELSE
(* If volume label, output it along with *)
(* its creation time and date. *)
BEGIN
Volume_Title := Left_Margin_String +
' Contents of volume ' +
Volume_Label +
' as of ' +
DateString +
' at ' +
TimeOfDayString;
IF Do_Printer_Format THEN
BEGIN
WRITELN( Output_File , FF_Char );
WRITE ( Output_File , Volume_Title );
WRITELN( Output_File , ' Page ', Page_Number );
END
ELSE
WRITELN( Output_File , Volume_Title );
Volume_Label := Volume_Label + DUPL( ' ' , 12 - LENGTH( Volume_Label ) );
Dir_Convert_Date( Vol_Date , SDate );
Dir_Convert_Time( Vol_Time , STime );
WRITELN( Output_File );
WRITE ( Output_File , Left_Margin_String,
' Volume: ',Volume_Label, ' Created: ',
SDate, ' ', STime );
Lines_Left := Lines_Left - 3;
END;
WRITELN( Output_File );
(* Count lines left on page *)
Lines_Left := Lines_Left - 2;
END (* Display_Volume_Label *);
(*----------------------------------------------------------------------*)
(* Display_Page_Titles --- Display page titles at top of page *)
(*----------------------------------------------------------------------*)
PROCEDURE Display_Page_Titles;
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Display_Page_Titles; *)
(* *)
(* Purpose: Displays page headers for paginated output file *)
(* *)
(* Calling sequence: *)
(* *)
(* Display_Page_Titles; *)
(* *)
(*----------------------------------------------------------------------*)
BEGIN (* Display_Page_Titles *)
(* Skip to top of new page using FF *)
WRITELN( Output_File , FF_Char );
(* Reset lines left to page size *)
Lines_Left := Page_Size;
(* Increment page count *)
Page_Number := SUCC( Page_Number );
(* Display extant titles *)
(* -- Volume title *)
WRITELN( Output_File );
WRITELN( Output_File , Volume_Title , ' Page ', Page_Number );
WRITELN( Output_File );
(* -- Subdirectory title *)
WRITELN( Output_File , Subdir_Title );
WRITELN( Output_File );
Lines_Left := Lines_Left - 5;
IF ( File_Title <> '' ) THEN
BEGIN
(* -- File title *)
WRITELN( Output_File , File_Title );
WRITELN( Output_File );
Lines_Left := Lines_Left - 2;
END;
END (* Display_Page_Titles *);
(* Archive display routines *)
(*$I PIBCATA.PAS *)
(* Library display routines *)
(*$I PIBCATL.PAS *)
(*----------------------------------------------------------------------*)
(* Move_File_Info --- Save file information for sorting *)
(*----------------------------------------------------------------------*)
PROCEDURE Move_File_Info( Full : Directory_Record;
VAR Short: Short_Dir_Record );
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Move_File_Info *)
(* *)
(* Purpose: Saves information about file in compact form *)
(* *)
(* Calling sequence: *)
(* *)
(* Move_File_Info( Full : Directory_Record; *)
(* VAR Short: Short_Dir_Record ); *)
(* *)
(* Full --- Directory info as retrieved from DOS *)
(* Short --- Directory info with garbage thrown out *)
(* *)
(* Remarks: *)
(* *)
(* This routine copies the useful stuff about a file to a *)
(* shorter record which is more easily sorted. *)
(* *)
(*----------------------------------------------------------------------*)
BEGIN (* Move_File_Info *)
Short.File_Date := Full.File_Date;
Short.File_Time := Full.File_Time;
Short.File_Size := Full.File_Size;
Short.File_Attr := Full.File_Attr;
Short.File_Name := COPY( Full.File_Name, 1,
POS( #0 , Full.File_Name ) - 1 );
END (* Move_File_Info *);
(*----------------------------------------------------------------------*)
(* Display_File_Info --- Display information about a file *)
(*----------------------------------------------------------------------*)
PROCEDURE Display_File_Info( Dir_Entry : Short_Dir_Record );
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Display_File_Info *)
(* *)
(* Purpose: Displays information for current file *)
(* *)
(* Calling sequence: *)
(* *)
(* Display_File_Info( Dir_Entry : Short_Dir_Record ); *)
(* *)
(* Dir_Entry --- Directory record describing file *)
(* *)
(* Remarks: *)
(* *)
(* The counters for total number of files and total file space *)
(* used are incremented here. *)
(* *)
(*----------------------------------------------------------------------*)
VAR
RLength : REAL;
STime : STRING[10];
SDate : STRING[10];
I : INTEGER;
BEGIN (* Display_File_Info *)
WITH Dir_Entry DO
BEGIN
(* Get length *)
RLength := Long_To_Real( File_Size );
(* Get date and time of creation *)
Dir_Convert_Date( File_Date , SDate );
Dir_Convert_Time( File_Time , STime );
(* Write out file name *)
WRITE( Output_File , Left_Margin_String , ' ' , File_Name );
FOR I := LENGTH( File_Name ) TO 13 DO
WRITE( Output_File , ' ');
(* Write length, date, and time *)
WRITE ( Output_File , RLength:8:0, ' ' );
WRITE ( Output_File , SDate, ' ' );
WRITE ( Output_File , STime );
WRITELN( Output_File );
(* Count lines left on page *)
IF Do_Printer_Format THEN
BEGIN
Lines_Left := Lines_Left - 1;
IF ( Lines_Left < 1 ) THEN
Display_Page_Titles;
END;
END;
(* Increment total file count *)
Total_Files := Total_Files + 1;
(* Increment total space used *)
Total_Space := Total_Space + RLength;
END (* Display_File_Info *);
(*----------------------------------------------------------------------*)
(* Sort_Files --- Sort files in ascending order by name *)
(*----------------------------------------------------------------------*)
PROCEDURE Sort_Files( First : INTEGER;
Last : INTEGER );
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Sort_Files *)
(* *)
(* Purpose: Sorts file names in current directory *)
(* *)
(* Calling sequence: *)
(* *)
(* Sort_Files( First : INTEGER; Last : INTEGER ); *)
(* *)
(* First --- First entry in 'File_Stack' to sort *)
(* Last --- Last entry in 'File_Stack' to sort *)
(* *)
(* Remarks: *)
(* *)
(* A shell sort is used to put the file names for the current *)
(* directory in ascending order. The current directory's files *)
(* are bracketed by 'First' and 'Last'. *)
(* *)
(*----------------------------------------------------------------------*)
VAR
Temp : Short_Dir_Record;
I : INTEGER;
J : INTEGER;
D : INTEGER;
BEGIN (* Sort_Files *)
D := ( Last - First + 1 );
WHILE( D > 1 ) DO
BEGIN
IF ( D < 5 ) THEN
D := 1
ELSE
D := TRUNC( 0.45454 * D );
FOR I := ( Last - D ) DOWNTO First DO
BEGIN
Temp := File_Stack[I];
J := I + D;
WHILE( ( Temp.File_Name > File_Stack[J].File_Name ) AND ( J <= Last ) ) DO
BEGIN
File_Stack[J-D] := File_Stack[J];
J := J + D;
END;
File_Stack[J-D] := Temp;
END;
END;
END (* Sort_Files *);
(*----------------------------------------------------------------------*)
(* Find_Files --- Recursively search directories for files *)
(*----------------------------------------------------------------------*)
PROCEDURE Find_Files( VAR Subdir : AnyStr;
VAR File_Spec : AnyStr;
Attr : INTEGER;
Levels : INTEGER );
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Find_Files *)
(* *)
(* Purpose: Recursively traverses directories looking for files *)
(* *)
(* Calling sequence: *)
(* *)
(* Find_Files( VAR Subdir : AnyStr; *)
(* VAR File_Spec : AnyStr; *)
(* Attr : INTEGER; *)
(* Levels : INTEGER ); *)
(* *)
(* Subdir --- subdirectory name of this level *)
(* File_Spec --- DOS file spec to match *)
(* Attr --- attribute type to match *)
(* Levels --- current subdirectory level depth *)
(* *)
(* Remarks: *)
(* *)
(* This is the actual heart of PibCat. This routine invokes *)
(* itself recursively to traverse all subdirectories looking for *)
(* files which match the given file specification. *)
(* *)
(*----------------------------------------------------------------------*)
VAR
Dir_Entry : Directory_Record;
Path : AnyStr;
Error : INTEGER;
I : INTEGER;
Dir : STRING[14];
Cur_Count : INTEGER;
Skip_Attr : INTEGER;
Files_Here : INTEGER;
LABEL Quit;
BEGIN (* Find_Files *)
(* Save current file count *)
Cur_Count := File_Count;
(* No files in this directory yet *)
Files_Here := 0;
(* Don't list directories as files *)
Skip_Attr := Attribute_Volume_Label + Attribute_Subdirectory;
IF ( Levels >= 1 ) THEN
BEGIN
(* Get full file spec to search for *)
Path := Subdir + File_Spec;
(* Need "Z" format string for DOS *)
Convert_String_To_AsciiZ( Path );
(* Get first file on this level *)
Error := Dir_Find_First_File( Path , Dir_Entry );
(* Get info on remaining files *)
(* on this level. *)
WHILE ( Error = 0 ) DO
BEGIN
(* Increment count of files in this dir *)
(* including subdirectories *)
File_Count := SUCC( File_Count );
(* Increment non-directory file count *)
IF ( ( Dir_Entry.File_Attr AND Skip_Attr ) = 0 ) THEN
Files_Here := SUCC( Files_Here );
(* Save info on this file *)
Move_File_Info ( Dir_Entry , File_Stack[File_Count] );
(* Get next file entry *)
Error := Dir_Find_Next_File( Dir_Entry );
(* Check for ^C at keyboard *)
IF KeyPressed THEN
IF QuitFound THEN
GOTO Quit;
END;
(* Sort file names *)
Sort_Files( Cur_Count + 1 , File_Count );
(* Increment directory count *)
Total_Dirs := Total_Dirs + 1;
(* Report scanning this subdirectory *)
WRITELN(' Scanning: ', Subdir );
(* Display file info header *)
IF ( Files_Here > 0 ) THEN
BEGIN
Subdir_Title := Left_Margin_String + ' Directory: ' + Subdir;
IF Do_Printer_Format THEN
IF ( Lines_Left < 4 ) THEN
Display_Page_Titles
ELSE
BEGIN
WRITELN( Output_File );
WRITELN( Output_File , Subdir_Title );
WRITELN( Output_File );
END
ELSE
BEGIN
WRITELN( Output_File );
WRITELN( Output_File , Subdir_Title );
WRITELN( Output_File );
END;
(* Count lines left on page *)
IF Do_Printer_Format THEN
BEGIN
Lines_Left := Lines_Left - 3;
IF ( Lines_Left < 1 ) THEN
Display_Page_Titles;
END;
END;
(* Display info on all files *)
(* But don't display directories! *)
FOR I := ( Cur_Count + 1 ) TO File_Count DO
BEGIN
IF ( ( File_Stack[I].File_Attr AND Skip_Attr ) = 0 ) THEN
Display_File_Info( File_Stack[I] );
IF KeyPressed THEN
IF QuitFound THEN
GOTO Quit;
END;
(* List .LBR/.ARC if requested *)
IF Expand_Arcs THEN
BEGIN
(* List contents of any .ARC files *)
FOR I := ( Cur_Count + 1 ) TO File_Count DO
BEGIN
IF ( POS( '.ARC', File_Stack[I].File_Name ) > 0 ) THEN
Display_Archive_Contents( Subdir + File_Stack[I].File_Name );
IF KeyPressed THEN
IF QuitFound THEN
GOTO Quit;
END;
(* List contents of any .LBR files *)
FOR I := ( Cur_Count + 1 ) TO File_Count DO
BEGIN
IF ( POS( '.LBR', File_Stack[I].File_Name ) > 0 ) THEN
Display_Lbr_Contents( Subdir + File_Stack[I].File_Name );
IF KeyPressed THEN
IF QuitFound THEN
GOTO Quit;
END;
END;
IF ( Levels >= 2 ) THEN
BEGIN
(* List all subdirectories to given level *)
(* Note: we read through whole directory *)
(* again since we probably excluded *)
(* directories on first pass. *)
Path := Subdir + '*.*';
Convert_String_To_AsciiZ( Path );
(* Get first file *)
Error := Dir_Find_First_File( Path , Dir_Entry );
(* While there are files left ... *)
WHILE ( Error = 0 ) DO
BEGIN
(* See if it's a subdirectory *)
IF ( ( Attribute_Subdirectory AND Dir_Entry.File_Attr ) <> 0 ) THEN
BEGIN
(* Yes -- get subdirectory name *)
Dir := COPY( Dir_Entry.File_Name, 1,
POS( #0 , Dir_Entry.File_Name ) - 1 );
(* Ignore '.' and '..' *)
IF ( ( Dir <> '.' ) AND ( Dir <> '..') ) THEN
BEGIN
(* Construct path name for subdirectory *)
Path := Subdir + Dir + '\';
(* List files in subdirectory *)
Find_Files( Path, File_Spec, Attr, Levels - 1 );
IF User_Break THEN
GOTO Quit;
END;
END;
(* Get next file entry *)
Error := Dir_Find_Next_File( Dir_Entry );
END (* WHILE *);
END (* IF Levels >= 2 *);
END (* IF Levels >= 1 *);
(* Restore previous file count *)
Quit:
File_Count := Cur_Count;
END (* Find_Files *);
(*----------------------------------------------------------------------*)
(* Perform_Cataloguing --- Do cataloguing of files *)
(*----------------------------------------------------------------------*)
PROCEDURE Perform_Cataloguing;
VAR
Name : AnyStr;
Subdir : AnyStr;
File_Spec : AnyStr;
I : INTEGER;
L : INTEGER;
Done : BOOLEAN;
BEGIN (* Perform_Cataloguing *)
(* Display volume label *)
Display_Volume_Label;
(* Append disk letter to file spec *)
IF ( POS( '\' , Find_Spec ) = 0 ) THEN
Name := Cat_Drive + ':\' + Find_Spec
ELSE
Name := Cat_Drive + ':' + Find_Spec;
(* Make sure some files get looked at! *)
IF Name[LENGTH(Name)] = '\' THEN
Name := Name + '*.*';
(* Split out directory from file spec *)
Subdir := Name;
I := LENGTH( Subdir ) + 1;
Done := FALSE;
REPEAT
I := I - 1;
IF ( I > 0 ) THEN
Done := ( Subdir[I] = '\' )
ELSE
Done := TRUE;
UNTIL Done;
I := LENGTH( Subdir ) - I;
File_Spec[0] := CHR( I );
MOVE( Subdir[ 1 + LENGTH( Subdir ) - I ] , File_Spec[ 1 ] , I );
Subdir[0] := CHR( LENGTH( Subdir ) - I );
(* Begin listing files at specified *)
(* subdirectory *)
Find_Files( Subdir, File_Spec, $FF, 9999 );
END (* Perform_Cataloguing *);
(*----------------------------------------------------------------------*)
(* Terminate --- Terminate cataloguing *)
(*----------------------------------------------------------------------*)
PROCEDURE Terminate;
BEGIN (* Terminate *)
(* Note if catalogue terminated by ^C *)
IF ( NOT Help_Only ) THEN
IF User_Break THEN
BEGIN
IF ( Lines_Left < 6 ) THEN
Display_Page_Titles;
WRITELN( Output_File );
WRITELN( Output_File , Left_Margin_String,
'>>>>> ^C typed, catalog listing INCOMPLETE.');
WRITELN( Output_File );
WRITELN( '^C typed, catalog listing INCOMPLETE.');
END
ELSE
BEGIN (* Indicate file totals *)
IF ( Lines_Left < 7 ) THEN
Display_Page_Titles;
WRITELN( Output_File );
WRITELN( Output_File , Left_Margin_String, ' Totals:');
WRITELN( Output_File , Left_Margin_String,
' Directories scanned: ',Total_Dirs:10:0);
WRITELN( Output_File , Left_Margin_String,
' Files selected : ',Total_Files:10:0);
WRITELN( Output_File , Left_Margin_String,
' Bytes in files : ',Total_Space:10:0);
WRITELN( Output_File , Left_Margin_String,
' Bytes free : ',
Dir_Get_Free_Space( Cat_Drive ):10:0 );
END;
(* Close output file *)
(*$I-*)
CLOSE( Output_File );
(*$I+*)
IF ( IOResult <> 0 ) THEN;
END (* Terminate *);
(*---------------------- Main Program of PIBCAT ------------------------*)
BEGIN (* PibCat *)
(* Initialize program. If initialization *)
(* goes OK, then perform cataloguing. *)
IF Initialize THEN
Perform_Cataloguing;
(* Close output file and terminate. *)
Terminate;
END (* PibCat *).